﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IWMAG.Scripting.AST.ObjectModel;
using IWMAG.Scripting.AST.Operators;

namespace IWMAG.Scripting.Compiler.Helpers {
    class OperatorMapping : List<List<Tuple<string, Type>>> {
        public OperatorMapping() {
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("||", typeof(BoolOrOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("&&", typeof(BoolAndOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("|", typeof(BitOrOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("^", typeof(BitXorOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("&", typeof(BitAndOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("==", typeof(EqOperator)),
                Tuple.Create("!=", typeof(NeqOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("<", typeof(LtOperator)),
                Tuple.Create(">", typeof(GtOperator)),
                Tuple.Create("<=", typeof(LteqOperator)),
                Tuple.Create(">=", typeof(GteqOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("<<", typeof(LShiftOperator)),
                Tuple.Create(">>", typeof(RShiftOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("+", typeof(AddOperator)),
                Tuple.Create("-", typeof(SubOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("*", typeof(MulOperator)),
                Tuple.Create("/", typeof(DivOperator)),
                Tuple.Create("%", typeof(ModOperator)),
            }));
            Add(new List<Tuple<string, Type>>(new Tuple<string, Type>[] {
                Tuple.Create("..", typeof(RangeOperator))
            }));
        }
    }
}
